package com.caogen.cg_wl_kt.ui.fragment.dashboard

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.caogen.cg_wl_kt.adapter.DashboardAdapter
import com.caogen.cg_wl_kt.base.BaseAdapter
import com.caogen.cg_wl_kt.base.BaseFragment
import com.caogen.cg_wl_kt.databinding.FragmentDashboardBinding
import com.caogen.cg_wl_kt.model.dashboard.DashboardBean
import com.caogen.cg_wl_kt.utils.YDLog
import com.caogen.cg_wl_kt.vmodel.fragment.DashboardViewModel

class DashboardFragment : BaseFragment<FragmentDashboardBinding,DashboardViewModel>() {
    //    private val adapter by lazy {
//        HomeAdapter(ItemHomeListBinding::inflate);
    //    }
    private lateinit var adapter: DashboardAdapter
    override fun initView(view: View?) {
        super.initView(view)
        vm.getListData()
        adapter = DashboardAdapter()

        binding.rcView.adapter = adapter
        adapter.setListData(vm.list)

    }

    override fun setListener() {
        super.setListener()
        adapter.mItemClickListener = object :BaseAdapter.OnItemClickListener<DashboardBean>{
            override fun onItemClick(item: DashboardBean, position: Int) {
                YDLog.logd(item.id +"==="+position)
            }
        }
    }

    override fun vmClass(): Class<DashboardViewModel> {
        return DashboardViewModel::class.java
    }

    override fun binding(inflater: LayoutInflater,container: ViewGroup?): FragmentDashboardBinding {
        return FragmentDashboardBinding.inflate(layoutInflater)
    }


}